package ssm.model;

import org.apache.ibatis.annotations.Param;
import ssm.dao.User;

public interface UserMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    int checkUsername(String username);

    User selectLogin(@Param("username")String username,
                     @Param("password")String password);

    int checkEmail(String email);

    String selectGetQuestByUsername(String username);

    int forgetAnswer(@Param("username") String username,
                     @Param("question")String question,
                     @Param("answer")String answer);

    int forgetRestPassword(@Param("username") String username,
                           @Param("newPassword") String newPassword);

    int findReapetByPassword(@Param("username") String username,
                             @Param("newPassword") String newPassword);

    int restPassword (@Param("username") String username,
                      @Param("oldPassword") String oldPassword,
                      @Param("newPassword") String newPassword);

    int checkPassword(@Param("id") Integer id,
                      @Param("oldPassword") String oldPassword);

    int checkEmailByUserId(@Param("id")Integer id,
                           @Param("email")String email);

    User getInformation(Integer id);
}
